home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 167 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.5 KB

  1. Path: engnews2.Eng.Sun.COM!taumet!clamage
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.std.c++
  4. Subject: Nonpolled response to asynchronous activity [Was "Throwing ...]
  5. Date: 29 Jan 1996 22:27:07 GMT
  6. Organization: University of California, Riverside Department of Computer Science
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4ejgu8$2vc@galaxy.ucr.edu>
  9. References: <4dgj4m$9la@engnews1.Eng.Sun.COM> <DLCosx.Hn1@falcon.daytonoh.attgis.com> <KANZE.96Jan19122409@gabi.gabi-soft.fr> <4ebptg$frt@galaxy.ucr.edu>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. X-Nntp-Posting-Host: corvette.ucr.edu
  13. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  14. Content-Length: 2616
  15. X-Lines: 55
  16. Originator: clamage@taumet
  17.  
  18. J. Kanze (kanze@gabi.gabi-soft.fr) wrote:
  19. : From ISO 9899, section 7.7.1.1: ``If the signal occurs other than as the
  20. : result of calling the abort or raise function, the behavior is undefined
  21. : if the signal handler calls any function in the standard library other
  22. : than the signal function itself (with a first argument of the signal
  23. : number corresponding to the signal tha caused the invocation of the
  24. : handler) or refers to any object with static storage duration other than
  25. : by assigning a value to a static storage duration variable of type
  26. : volatile sig_atomic_t.''
  27. : [...]
  28.  
  29. And I replied:
  30. : In other words, the only asynchronous activity allowed to programs
  31. : with defined behavior is polling volatile atomic variables that are
  32. : set by signal handlers.  Thus far, no one has given me a reason for
  33. : prohibiting signal handlers from reading volatile atomic variables,
  34. : which is a common practice in interrupt handlers (even those written
  35. : in C/C++).
  36.  
  37. Below is what I think does and should happen in practice (stated 
  38. somewhat legalistically):
  39.  
  40.    Between sequence points in a given invocation of a function, a
  41.    volatile variable may be updated by the given invocation and by 
  42.    multiple concurrent asynchronous activities, including signal
  43.    handlers and functions invoked by them.  To achieve coherence, 
  44.       *  prior to each of its sequence points, the function must
  45.          "backup" all updated volatile variables.
  46.       *  after each of its sequence points, the function must 
  47.          "refresh" local copies of volatile variables,
  48.  
  49.    At a given sequence point in a given function invocation, the 
  50.    value of a volatile variable will be:
  51.       *  its value as of the previous sequence point if there have 
  52.          been no intervening updates of the variable since then;
  53.       *  the update value if there is exactly one intervening update;
  54.       *  any of the update values if there are multiple intervening
  55.          updates and the variable is atomic;
  56.       *  unspecified, otherwise.
  57.    At each read access of a volatile variable by the given function 
  58.    invocation and/or concurrent asynchronous activites, the value 
  59.    obtained will be:
  60.       *  its value as of the previous sequence point if there are 
  61.          no intervening updates between that sequence point and the 
  62.          next;
  63.       *  that value or any of the update values if the variable is 
  64.          atomic;
  65.       *  unspecified, otherwise.
  66.  
  67. I think that the standards should be fixed to incorporate nonpolled
  68. response to asynchronous activity somewhat along the lines of this
  69. wording.
  70.  
  71. Tom Payne (thp@cs.ucr.edu)
  72.  
  73. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  74.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  75.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  76.  
  77.